﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using RayD.Core;

namespace RayD.Repository.Entites.SystemModule
{
    [Table("BASE_USERRELATION")]
    public class UserRelationEntity
    {
        #region 实体成员
        /// <summary>
        /// 用户关系主键
        /// </summary>
        /// <returns></returns>
        [Key]
        [Column("B_USERRELATIONID")]
        public string B_UserRelationId { get; set; }
        /// <summary>
        /// 分类:1-角色2-岗位
        /// </summary>
        /// <returns></returns>
        [Column("B_CATEGORY")]
        public int? B_Category { get; set; }
        /// <summary>
        /// 用户主键
        /// </summary>
        /// <returns></returns>
        [Column("B_USERID")]
        public string B_UserId { get; set; }
        /// <summary>
        /// 对象主键
        /// </summary>
        /// <returns></returns>
        [Column("B_OBJECTID")]
        public string B_ObjectId { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        /// <returns></returns>
        [Column("B_CREATEDATE")]
        public DateTime? B_CreateDate { get; set; }
        /// <summary>
        /// 创建用户主键
        /// </summary>
        /// <returns></returns>
        [Column("B_CREATEUSERID")]
        public string B_CreateUserId { get; set; }
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <returns></returns>
        [Column("B_CREATEUSERNAME")]
        public string B_CreateUserName { get; set; }
        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.B_UserRelationId = Guid.NewGuid().ToString();
            this.B_CreateDate = DateTime.Now.ToCstTime();
            UserInfo userInfo = AuthenticationHelper.LoginUserInfo;
            this.B_CreateUserId = userInfo.userId;
            this.B_CreateUserName = userInfo.realName;
        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        public void Modify()
        {
        }
        #endregion

        #region 扩展属性
        #endregion
    }
}
